GtkApplicationX11: read the startup ID from the platform data
authorGiovanni Campagna <gcampagna@src.gnome.org>
Wed, 1 Jan 2014 15:53:31 +0000 (16:53 +0100)
committerGiovanni Campagna <gcampagna@src.gnome.org>
Thu, 2 Jan 2014 20:17:22 +0000 (21:17 +0100)
If the platform data passed with actions and activations includes
a startup notify ID, we should read it and pass it down to GDK.
This ensures that the right startup notify is completed after the
signal emission, and that the user time of the GdkDisplay is properly
updated (which in turn makes sure the windows are not subjected
to focus-stealing-prevention)

https://bugzilla.gnome.org/show_bug.cgi?id=721304

gtk/gtkapplication-x11.c

index 1bd3f29b2aea723c143d0122c016a0677b0a176a..4ee5b8fec0e73f8e72996931f7da2cdbf54b0cd9 100644 (file)
@@ -78,6 +78,20 @@ gtk_application_impl_x11_init (GtkApplicationImplX11 *x11)
 {
 }
 
+static void
+gtk_application_impl_x11_before_emit (GtkApplicationImpl *impl,
+                                      GVariant           *platform_data)
+{
+  const char *startup_notification_id;
+
+  if (g_variant_lookup (platform_data, "desktop-startup-id",
+                        "&s", &startup_notification_id))
+    {
+      gdk_x11_display_set_startup_notification_id (gdk_display_get_default (),
+                                                   startup_notification_id);
+    }
+}
+
 static void
 gtk_application_impl_x11_class_init (GtkApplicationImplX11Class *class)
 {
@@ -86,4 +100,5 @@ gtk_application_impl_x11_class_init (GtkApplicationImplX11Class *class)
 
   impl_class->handle_window_realize = gtk_application_impl_x11_handle_window_realize;
   dbus_class->get_window_system_id = gtk_application_impl_x11_get_window_system_id;
+  impl_class->before_emit = gtk_application_impl_x11_before_emit;
 }